
const db = wx.cloud.database()
// pages/activity/activity.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    "card_data":[],
    "_id":"",
    showView: false
  },

  onChangeShowState: function () {
    var that = this;
    that.setData({
      showView: (!that.data.showView1)
    })
  },

  returnJump:function(e){
    wx.navigateTo({
      url: '../end2/end2',
    })
  },

  remove:function(e){
      // 等待窗口
      wx.showToast({
        title: 'Loading……',
        icon:"loading",
        duration:390000
      })
      console.log(this.data._id)
      db.collection('collection_data').doc(this.data._id).remove({
        success: function () {
          wx.showToast({
            title: '删除成功',
            duration:2000
          })
        }
      })
      this.onChangeShowState()
      this.returnJump()
  },
    
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  onShow: function () {
    console.log("collection=", getApp().globalData.collection)
    this.setData({
      card_data: getApp().globalData.collection.collection_data,
      _id:getApp().globalData.collection._id
    })

  },
})